package com.langsin.util;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.Connection;

public class DataSourceUtil {
    public static Connection getConnection() throws Exception{
        Context ctx = new InitialContext();
        ctx = (Context) ctx.lookup("java:/comp/env");
        DataSource source = (DataSource) ctx.lookup("java/webdb1");
        return source.getConnection();
    }
}
